﻿#include "alert.h"
#include <QMessageBox>

#pragma execution_character_set("utf-8")

const QString HintSystemTitle = "健岑医疗";
const QString HintYes = "是";
const QString HintNo = "否";

Alert::Alert()
{
}

void Alert::debug(const QString &s, QWidget* parent/* = NULL*/)
{
	QMessageBox msgBox(parent); 
	msgBox.setStyleSheet(
		"QPushButton {"
		"background-color:#6684D4;"
		" border-radius: 10px;"
		" font: bold 20px;"
		" min-width: 48px;"
		" min-height: 32px;"
		"}"
		"QLabel { min-width: 240px;font:20px;}"
		);

	msgBox.setWindowTitle(HintSystemTitle);
	msgBox.setText(s);
	msgBox.exec();
}

void Alert::display(const QString &s, QWidget* parent/* = NULL*/)
{
	QMessageBox msgBox(parent);
	msgBox.setStyleSheet(
		"QPushButton {"
		"background-color:#6684D4;"
		" border-radius: 10px;"
		" font: bold 20px;"
		" min-width: 48px;"
		" min-height: 32px;"
		"}"
		"QLabel { min-width: 240px;font:20px;}"
		);

	msgBox.setWindowTitle(HintSystemTitle);
    msgBox.setText(s);
    msgBox.exec();
}

bool Alert::confirm(const QString &s, QWidget* parent/* = NULL*/){
	QMessageBox msgBox(parent); 
	msgBox.setStyleSheet(
		"QPushButton {"
		"background-color:#6684D4;"
		" border-radius: 10px;"
		" font: bold 20px;"
		" min-width: 48px;"
		" min-height: 32px;"
		"}"
		"QLabel { min-width: 240px;font:20px;}"
		);

	msgBox.setWindowTitle(HintSystemTitle);
	msgBox.setText(s);
	msgBox.setStandardButtons(QMessageBox::Yes | QMessageBox::No);
	msgBox.setButtonText(QMessageBox::Yes, HintYes);
	msgBox.setButtonText(QMessageBox::No, HintNo);
	return (msgBox.exec() == QMessageBox::Yes);
}
